$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'customer/list?userStatus=2,3',
        datatype: "json", 
        colModel: [	  
			{ label: 'Id', name: 'userId', index: "userId", key: true,hidden:true },
			{ label: '认证企业名称', name: 'company', index: 'company', width: 80 },
			{ label: '提交审核时间', name: 'createTime', index: 'createTime', width: 80 }, 			
			{ label: '主账号电话', name: 'mobile', index: 'mobile', width: 80 }, 			
			{ label: '状态', name: 'userStatusDesc', index: 'userStatusDesc', width: 80 }			
		],      
		viewrecords: true,   
        height: 385, 
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
        q:{
            name: null
        },
		showList: true,
		title: null
	},
	methods: {
		query: function () {
			vm.reload();
		},
		
		updStatus: function (userStatus) {
			var ids = getSelectedRows();
			if(ids == null){
				return ;
			}  
			confirm('确定要对选中的数据进行操作？', function(){
				$.get(baseURL + "customer/updStatus?userStatus="+userStatus+"&ids="+ids, function(result){
            		alert('操作成功'); 
            		vm.reload(); 
            	});  
			}); 
		},  
		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{
                postData:{'name': vm.q.name},
                page:page
            }).trigger("reloadGrid");
		}
	}
});